#ifndef FILESYS_INODE_H
#define FILESYS_INODE_H

#include <stdbool.h>
#include "filesys/off_t.h"
#include "devices/block.h"

struct bitmap;
struct inode_disk;
struct inode;

void inode_init (void);
bool inode_create (block_sector_t, off_t);
struct inode *inode_open (block_sector_t);
struct inode *inode_reopen (struct inode *);
block_sector_t inode_get_inumber (const struct inode *);
void inode_close (struct inode *);
void inode_remove (struct inode *);
off_t inode_read_at (struct inode *, void *, off_t size, off_t offset);
off_t inode_write_at (struct inode *, const void *, off_t size, off_t offset);
void inode_deny_write (struct inode *);
void inode_allow_write (struct inode *);
off_t inode_length (const struct inode *);
bool inode_availabe(const struct inode *);

//ht

bool add_direct(struct inode_disk *disk_inode,void *buffer);
bool add_indirect1(struct inode_disk *disk_inode,void *buffer);
bool add_indirect2(struct inode_disk *disk_inode,void *buffer);

bool is_direct_full(struct inode_disk *disk_inode);
bool is_indirect1_full(struct inode_disk *disk_inode);

void release_direct(struct inode_disk *disk_inode);
void release_indirect1(struct inode_disk *disk_inode);
void release_indirect2(struct inode_disk *disk_inode);

uint32_t get_depth(struct inode *ind);
void set_depth(block_sector_t sector,uint32_t dep);
#endif /* filesys/inode.h */
